//package com.ruoyi.common.core.config;
//
//import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler;
//import com.ruoyi.common.core.utils.CookieUtil;
//import com.ruoyi.common.core.utils.uuid.UUID;
//import org.apache.ibatis.reflection.MetaObject;
//import org.springframework.stereotype.Component;
//
//import javax.annotation.Resource;
//import javax.servlet.http.HttpServletRequest;
//import java.util.Date;
//
///**
// * 自动补充插入或更新时的值
// * @author lr
// * @date 2019-06-03 18:26
// */
//@Component
//public class MybatisPlusMetaObjectHandler implements MetaObjectHandler {
//    @Resource
//    HttpServletRequest request ;
//
//    @Override
//    public void insertFill(MetaObject metaObject) {
//        this.setFieldValByName("createBy", CookieUtil.getLoginUser(request),metaObject);
//        this.setFieldValByName("createTime", new Date(),metaObject);
//        this.setFieldValByName("updateBy", CookieUtil.getLoginUser(request),metaObject);
//        this.setFieldValByName("updateTime", new Date(),metaObject);
//        this.setFieldValByName("version", 1L,metaObject);
//        this.setFieldValByName("appSecret", UUID.randomUUID().toString().replaceAll("-",""),metaObject);
//    }
//
//    @Override
//    public void updateFill(MetaObject metaObject) {
//        this.setFieldValByName("updateBy", CookieUtil.getLoginUser(request),metaObject);
//        this.setFieldValByName("updateTime", new Date(),metaObject);
//        this.setFieldValByName("version", this.getFieldValByName("version",metaObject),metaObject);
//    }
//}
